<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="4.0" encoding="iso-8859-1" indent="yes"/>

<xsl:template match="/">
	<script type="text/javascript">
	$(document).ready(function($){
		$('#mega-menu-tut').dcMegaMenu({
			rowItems: '4',
			speed: 'fast'
		});
	});
	</script>

    <div id="MenuGeneral" class="dcjq-mega-menu">
		<ul id="mega-menu-tut" class="menu">
			<xsl:for-each select="/menu/level1[not(@suppression='true') and not(@visible='false')]">
				<xsl:variable name="nameN1" select="@namepiwik"/>
				<xsl:if test="level2[not(@suppression='true') and not(@visible='false')]">
					<li>
						<xsl:if test="level2/level3">
							<xsl:attribute name="class">mega-hdr_links <xsl:value-of select="@class"/></xsl:attribute>
						</xsl:if>
						<xsl:if test="not(level2/level3)">
							<xsl:attribute name="class"><xsl:value-of select="@class"/></xsl:attribute>
						</xsl:if>
						<xsl:if test="@link">
							<a href="{@link}" onclick="javascript:_paq.push(['trackPageView', '{$nameN1}']);" class="dc-mega">
								<xsl:if test="@tools = 'true' or @target">
									<xsl:attribute name="target">_blank</xsl:attribute>
								</xsl:if>
								<xsl:value-of select="@name"/>
							</a>
						</xsl:if>
						<xsl:if test="not(@link)">
							<span class="dc-mega"><xsl:value-of select="@name"/></span>
						</xsl:if>
						
						<div class="sub-container">
							<ul class="sub">
                        		<div class="row">
									<xsl:for-each select="level2[not(@suppression='true') and not(@visible='false')]">
										<xsl:variable name="nameN2" select="@namepiwik" />
										<li class="mega-hdr">
											<ul>
												<xsl:if test="level3[not(@suppression='true') and not(@visible='false')]">
													<li class="{@class}">
														<xsl:if test="@link">
															<a href="{@link}" onclick="javascript:_paq.push(['trackPageView', '{$nameN1}/{$nameN2}']);" class="mega-hdr-a">
																<xsl:if test="@tools = 'true' or @target">
																	<xsl:attribute name="target">_blank</xsl:attribute>
																</xsl:if>
																<xsl:value-of select="@name"/>
															</a>
														</xsl:if>
														<xsl:if test="not(@link)">
															<span class="mega-hdr-span"><xsl:value-of select="@name"/></span>
														</xsl:if>
														<ul>
															<xsl:for-each select="level3[not(@suppression='true') and not(@visible='false')]">
																<xsl:variable name="nameN3" select="@namepiwik"/>
																<li class="{@class} {@lastlink}">
																	<a href="{@link}" onclick="javascript:_paq.push(['trackPageView', '{$nameN1}/{$nameN2}/{$nameN3}']);">
																		<xsl:if test="@tools = 'true' or @target">
																			<xsl:attribute name="target">_blank</xsl:attribute>
																		</xsl:if>
																		<xsl:value-of select="@name"/>
																	</a>
																</li>
															</xsl:for-each>
														</ul>
													</li>
												</xsl:if>
												<xsl:if test="not(level3[not(@suppression='true') and not(@visible='false')])">
													<li class="{@class}">
														<xsl:if test="not(@link)">
															<span class="mega-hdr-span"><xsl:value-of select="@name"/></span>
														</xsl:if>
														<xsl:if test="@link">
															<a href="{@link}" onclick="javascript:_paq.push(['trackPageView', '{$nameN1}/{$nameN2}']);">
																<xsl:if test="@tools = 'true' or @target">
																	<xsl:attribute name="target">_blank</xsl:attribute>
																</xsl:if>
																<xsl:value-of select="@name"/>
															</a>
														</xsl:if>
													</li>
												</xsl:if>
											</ul>
										</li>
									</xsl:for-each>
								</div>
							</ul>
						</div>
					</li>
				</xsl:if>
				<xsl:if test="not(level2[not(@suppression='true') and not(@visible='false')])">
					<li class="{@class}">
						<xsl:if test="@link='/' or @link='/Pages/Accueil2013.aspx' or @link='/Pages/default.aspx'">
							<xsl:attribute name="class"><xsl:value-of select="concat('picto_home ', @class)"/></xsl:attribute>
						</xsl:if>
					<a href="{@link}" onclick="javascript:_paq.push(['trackPageView', '{$nameN1}']);">
						<xsl:if test="@tools = 'true' or @target">
							<xsl:attribute name="target">_blank</xsl:attribute>
						</xsl:if>
						<xsl:if test="not(@link='/') and not(@link='/Pages/Accueil2013.aspx') and not(@link='/Pages/default.aspx')">
							<xsl:value-of select="@name"/>
						</xsl:if>
					</a></li>
				</xsl:if>
			</xsl:for-each>
			<xsl:choose>
				<xsl:when test="/menu/@currentPage">
					<xsl:if test="/menu[not(@currentPage='homePage')]"> 
						<xsl:call-template name="recherche" />
					</xsl:if>
				</xsl:when>
				<xsl:otherwise>
					<xsl:call-template name="recherche" />
				</xsl:otherwise>
			</xsl:choose>
		</ul>
		<xsl:if test="/menu[@currentPage='homePage']"> 
		<div class="new-widget">
		</div>
		</xsl:if>
	</div>
</xsl:template>
<xsl:template name="recherche">
	<li class="liSearch">
		<div class="search">
			<table cellpadding="0px" cellspacing="0px"> 
				<tr> 
					<td>
						<input class="vplinksearch" type="text" value="Recherche VPLink" id="fldVplinkSearsh" />
					</td>
					<td> 
						<input type="button" id="btnVplinkSearsh" value="" class="vplinksearshVisual"/>
					</td>
				</tr>
			</table>
		</div>
	</li>
</xsl:template>
</xsl:stylesheet>